-
Notifications
You must be signed in to change notification settings - Fork 15
Fix: clone stories excluding status #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aisayo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/models/project.rb
Outdated
| def clone_stories_into(clone) | ||
| stories.each { |story| clone.stories.create(story.dup.attributes) } | ||
| stories.each do |story| | ||
| attrs = story.dup.attributes.except("status", "id", "created_at", "updated_at") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFI: we do not need to add the id, created_at, updated_at the dup method removed them already
| attrs = story.dup.attributes.except("status", "id", "created_at", "updated_at") | |
| attrs = story.dup.attributes.except(:status) |
In the other hand, I was wondering if instead of except attributes we would want to accept only the "clonable" attributes we need, I'm thinking towards the future when someone adds more attributes those will be cloned and maybe we don't want that, makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I have updated.


Jira Ticket
https://ombulabs.atlassian.net/browse/STJ-14
Motivation / Context
Fix for #347
While cloning the stories, I have excluded status of the story alongside some other attributes. Wrote specs to check the behaviour.
QA / Testing Instructions
How do I achieve this behavior? Use the following format to provide a step-by-step guide:
Step 1: create a project and approve/reject some stories
Step 2: clone it
Step 3: new project has some stories, all of them marked as pending.
Screenshots:
I will abide by the code of conduct.